package cn.hhz._06interceptor.config;

import cn.hhz._06interceptor.interceptors.MyInterceptor1;
import cn.hhz._06interceptor.interceptors.Myinterceptor2;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class MvcConfig implements WebMvcConfigurer {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //所有请求
//        registry.addInterceptor(new MyInterceptor1());
        //只拦截登录
       // registry.addInterceptor(new MyInterceptor1())
//                .addPathPatterns("/v1/users/login","/v1/users/reg");
        //用户模块所有请求
        registry.addInterceptor(new MyInterceptor1());

        registry.addInterceptor(new Myinterceptor2());
    }
}
